package com.wandian.game
{
	import flash.net.SharedObject;

	public class GameData
	{
		public static var ip:String="192.168.1.9"
		public static var port:int=84
		public static var name:String="AnSense"
		public static var password:String="ansense"
		public static var gameID:int=11
		public static var tableID:int=1
		public static var checkCode:String
		private static var money:Number=10000

		public static function getMoney():Number{
			return money;
		}
		public static function addMoney(v:Number):void{
			money+=v;
		}
		public static function deductMoney(v:Number):Boolean{
			if(v>money){
				return false;
			}
			money-=v
			return true;
		}
		public static function readCache():void{
			var mySo:SharedObject = SharedObject.getLocal("GameInfo");
			
			ip=mySo.data["ip"]
			port=mySo.data["port"]
			name=mySo.data["name"]
			password=mySo.data["password"]
			gameID=mySo.data["gameID"]
			tableID=mySo.data["tableID"]

			//if(mySo.data.
		}
		public static function saveCache():void{
			var mySo:SharedObject = SharedObject.getLocal("GameInfo");
			
			mySo.data["ip"]=ip
			mySo.data["port"]=port
			mySo.data["name"]=name
			mySo.data["password"]=password
			mySo.data["gameID"]=gameID
			mySo.data["tableID"]=tableID
			
			//if(mySo.data.
		}
	}
}